/*
 * Copyright (c) 2007
 *	Alberto Magni, Maggioni Marcello
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 */

package Database;
import exceptions.DatabaseException;
/** AddressesDB provides methods to manage the addresses of the default recipients of an user.
 * @author Marcello Maggioni*/
public interface AddressesDB 
{
    /**Return the list of the default addresses of a given user.
     *@param username the user whom addresses are searched
     *@return the list of the recipients of the user
     *@throws exceptions.DatabaseException
     */
    public String[] getAddresses(String username) throws DatabaseException;
//------------------------------------------------------------------------------
    /**Set the dafault list of addresses of a given user.
     *@param addresses the list of addresses to be set
     *@param username the user who holds the addresses
     *@param original_filename The filename of the original file. If the file doesn't come from a conversion from another file set this to null or empty string
     *@throws exceptions.DatabaseException 
     */
    public void setAddresses(String[] addresses, String username, String original_filename) throws DatabaseException;
    /**
     * Returns the original filename of the addresses file. Null is returned if there isn't a previous filename
     * @param username The username for which the information is required.
     * @return The original filename of the addresses file. Null otherwise.
     * @throws exceptions.DatabaseException
     */
    public String getOriginalFilename(String username) throws DatabaseException;
//------------------------------------------------------------------------------
    /**Remove the list of addresses of given user.
     @param username the user whom addresses have to be removed*/
    public void removeAddresses(String username);
   // public void changeUsername(String olduser, String newuser);
    /**
     *  Generates a byte representation in XML format (UTF-8 format) of the address list of the given user
     * @param username The username of the user of which the list is desired
     * @return A byte representation in XML Format (UTF-8 format) of the address list of the user
     * @throws exceptions.DatabaseException
     */
    public byte[] xmlByteRepresentation(String username) throws DatabaseException;
}
